﻿<%@ Page Title="" Language="C#" MasterPageFile="~/EasyUI.Master" AutoEventWireup="true" CodeBehind="showNewsFileSearch.aspx.cs" Inherits="LCrs.Web.news.showNewsFileSearch" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
   <script src="../Script/datetime.js"></script>
    <script src="listnewsfilesearch.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#tt').datagrid({
                title: '文件检索', //表格标题
                url: 'GetNews.ashx', //请求数据的页面
                sortName: 'newsTime', //排序字段
                idField: 'newsId', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
                //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                method: 'post',
                columns: [[
                { title: '新闻标题', field: 'newsTitle', width: 80, sortable: true },
                {
                    title: '内容简介', field: 'newsContent', width: 100, formatter: function (value, row, index) {
                        return "<a href='#' onclick=showNews('" + row.newsId + "') >" + subContent(row.newsContent) + "</a>";
                    }
                },
                { title: '发布时间', field: 'newsTime', width: 150 },
                { title: '作者', field: 'newsAuthor', width: 50 }

                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "queryfilesearch" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                rownumbers: true //行号
            });
        });

        function showNews(newsId) {

            $.ajax({
                type: "post",
                dataType: "json",
                url: "GetNews.ashx?action=querymodel&newsId=" + newsId,
                success: function aa(data) {
                    //level = data[0].level;
                    //var name = data[0].name;
                    //var uadd = data[0].province + data[0].city + data[0].county + data[0].uadd;
                    //$("#myinfos").text("用户名：" + name);

                    $('#newsDig').dialog('open').dialog('setTitle', '通知公告');
                    //var t = data.rows[0].newsAuthor;
                    $('#newsAuthor').html(data.rows[0].newsAuthor);
                    $('#newsContent').html(data.rows[0].newsContent);
                    $('#newsTime').html(data.rows[0].newsTime);
                    $('#newsTitle').html(data.rows[0].newsTitle);
                    if (data.rows[0].newsUrl != "") {
                        $('#newsUrl').show();
                        $('#newsUrl').attr("href", "http://" + window.location.host + data.rows[0].newsUrl);
                    }
                    else {
                        $('#newsUrl').hide();
                    }

                    //$('#test').html("http://"+window.location.host + data.rows[0].newsUrl);
                }
            });


        }

        //初始化搜索框
        function InitSearch() {
            $("#ipt_search").searchbox({
                width: 200,
                //iconCls: 'icon-save',
                searcher: function (val, name) {
                    $('#tt').datagrid('options').queryParams.search_type = name;
                    $('#tt').datagrid('options').queryParams.search_value = val;
                    $('#tt').datagrid('reload');
                },
                prompt: '请输入查询信息'
            });

        }

    </script>
    <style type="text/css">
         .datagrid-header {
            position: absolute; visibility: hidden;
            }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <table id="tt">
    </table>
    <div id="tab_toolbar" style="padding: 4px;">
        <table cellpadding="0" cellspacing="0" style="width: 100%">
            <tr>
                <td style="text-align: right; padding-right: 15px">
                    <input id="ipt_search" menu="#search_menu" />
                    <div id="search_menu" style="width: 120px">
                        <div name="newsTitle">
                            标题
                        </div>
                         <div name="newsContent">
                            内容
                        </div>
                    </div>
                </td>
            </tr>
        </table>

    </div>
    <div id="newsDig" class="easyui-dialog" style="width: 600px; height: 580px; padding: 2px"
        data-options="closed:true,buttons:'#dlg-buttons',shadow:false">
            <div id="mytt" class="easyui-tabs" style="width: 100%; height: 100%;">
                <div title="文件检索" class="myh" style="padding: 5px;">
                    <table>
                        <tr>
                            <td>标题：</td>
                            <td>
                                <span id="newsTitle" name="newsTitle" ></span>
                            </td>
                        </tr>
                        <tr>
                            <td>作者：</td>
                            <td>
                                <span id="newsAuthor" name="newsAuthor"  />
                             
                            </td>
                        </tr>
                         <tr>
                            <td>发布日期：</td>
                            <td>
                               <span id="newsTime" name="newsTime"/>
                            </td>
                        </tr>
                          <tr>
                            <td>附件下载：</td>
                            <td>
                               <a id="newsUrl" name="newsUrl" href="#" style="color:blue">附件下载</a>
                                <span id="test" name="test"/>
                            </td>
                        </tr>
                        <tr>
                            <td>内容：</td>
                            <td style="width:500px;height:500px;" >
                                <span id="newsContent" name="newsContent" style="word-wrap:break-word;word-break:keep-all;overflow:hidden;"  >

                                </span>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
    </div>
</asp:Content>
